package com.zsqx.tools;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.ResourceBundle;

public class PropertiesTools {

	/**
	 * 获取文件名,到毫秒
	 * @return
	 */
	public static String getFileName(){
		return new SimpleDateFormat("yyyyMMddHHmmssms").format(new Date());
	}
	/**
	 * 获取excel路径
	 * @param absolutePath
	 * @return
	 */
	public static String getExcelUploadURL(){
		return getPropertyValue("ExportExcelPath");
	}
	/**
	 * 获取图片路径
	 * @param absolutePath
	 * @return
	 */
	public static String getImageUploadURL(String absolute_path){
		return absolute_path+getPropertyValue("ImageUploadPath");
	}
	
	/**
	 * 日期格式转换
	 * @param date
	 * @param fromPatten
	 * @param toPatten
	 * @return
	 * @throws ParseException
	 */
	public static String formatDate(String date,String fromPatten,String toPatten) throws ParseException{
		return new SimpleDateFormat(toPatten).format(new SimpleDateFormat(fromPatten).parse(date));
	}
	
	public static String getPropertyValue(String key){
		return ResourceBundle.getBundle("config").getString(key); 
	}
	
}
